import Vue from "vue";
import Vuex from 'vuex';

import mutations from "./mutations";
import actions from "./actions";
import getters from "./getters";
import moduleA from "./modules/moduleA";
import {
  INCREMENT,
}from "./Mutations-types"

//1.安装插件
Vue.use(Vuex)

//2.创建对象
const state = {
  //用于保存状态
  counter:1000,
  students:[
    { id:100, name:'why', age:30},
    { id:101, name:'coder', age:31},
    { id:102, name:'flower', age:16},
    { id:103, name:'sky', age:15},
  ],
  info:{
    name:'kobe',
    age:40,
    height:1.98
  }
}

const store = new Vuex.Store({
  state: state,
  mutations:mutations,
  actions:actions,
  getters:getters,
  modules:{
    a:moduleA,
  },
})

//3.导出Store
export default  store

//对象的解构
// const obj ={
//   name:'why',
//   age:18,
//   height: 1.88,
// }
// const {name,age,height} = obj;
// console.log(name);
